home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / PInterfaces / Editions.p < prev    next >
Encoding:
Text File  |  1992-01-29  |  11.3 KB  |  340 lines  |  [TEXT/MPS ]

  1.  
  2. {
  3. Created: Tuesday, January 29, 1991 at 6:35 PM
  4.  Editions.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1989-1991
  8.   All rights reserved
  9. }
  10.  
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT Editions;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingEditions}
  22. {$SETC UsingEditions := 1}
  23.  
  24. {$I+}
  25. {$SETC EditionsIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingMemory}
  28. {$I $$Shell(PInterfaces)Memory.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingTypes}
  31. {$I $$Shell(PInterfaces)Types.p}
  32. {$ENDC}
  33. {$IFC UNDEFINED UsingFiles}
  34. {$I $$Shell(PInterfaces)Files.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED UsingAliases}
  37. {$I $$Shell(PInterfaces)Aliases.p}
  38. {$ENDC}
  39. {$SETC UsingIncludes := EditionsIncludes}
  40.  
  41. CONST
  42.  
  43. { resource types  }
  44. rSectionType = 'sect';                        { ResType of saved SectionRecords }
  45.  
  46. { section types }
  47. stSubscriber = $01;
  48. stPublisher = $0A;
  49.  
  50. sumAutomatic = 0;                            { subscriber update mode - Automatically     }
  51. sumManual = 1;                                { subscriber update mode - Manually }
  52. pumOnSave = 0;                                { publisher update mode - OnSave            }
  53. pumManual = 1;                                { publisher update mode - Manually }
  54.  
  55. kPartsNotUsed = 0;
  56. kPartNumberUnknown = -1;                    { misc }
  57.  
  58. kPreviewWidth = 120;
  59. kPreviewHeight = 120;
  60.  
  61. kPublisherDocAliasFormat = 'alis';
  62. kPreviewFormat = 'prvw';
  63. kFormatListFormat = 'fmts';
  64.  
  65. { bits for formatsMask }
  66. kPICTformatMask = 1;
  67. kTEXTformatMask = 2;
  68. ksndFormatMask = 4;
  69.  
  70. { Finder types for edition files }
  71. kPICTEditionFileType = 'edtp';
  72. kTEXTEditionFileType = 'edtt';
  73. ksndEditionFileType = 'edts';
  74. kUnknownEditionFileType = 'edtu';
  75.  
  76. { pseudo-item hits for dialogHooks 
  77.  the first if for NewPublisher or NewSubscriber Dialogs }
  78. emHookRedrawPreview = 150;
  79.  
  80. { the following are for SectionOptions Dialog }
  81. emHookCancelSection = 160;
  82. emHookGoToPublisher = 161;
  83. emHookGetEditionNow = 162;
  84. emHookSendEditionNow = 162;
  85. emHookManualUpdateMode = 163;
  86. emHookAutoUpdateMode = 164;
  87.  
  88. { the refcon field of the dialog record during a modalfilter 
  89.  or dialoghook contains one the following }
  90. emOptionsDialogRefCon = 'optn';
  91. emCancelSectionDialogRefCon = 'cncl';
  92. emGoToPubErrDialogRefCon = 'gerr';
  93. kFormatLengthUnknown = -1;
  94.  
  95. TYPE
  96. SectionType = SignedByte;                    { one byte, stSubscriber or stPublisher }
  97. TimeStamp = LONGINT;                        { seconds since 1904 }
  98. FormatType = PACKED ARRAY [1..4] OF CHAR;    { similar to ResType as used by scrap mgr }
  99. EditionRefNum = Handle;                        { used in Edition I/O }
  100. { update modes }
  101. UpdateMode = INTEGER;                        { sumAutomatic, pumSuspend, etc }
  102.  
  103. SectionPtr = ^SectionRecord;
  104. SectionHandle = ^SectionPtr;
  105. SectionRecord = RECORD
  106.  version: SignedByte;                        { always 0x01 in system 7.0 }
  107.  kind: SectionType;                            { stSubscriber or stPublisher }
  108.  mode: UpdateMode;                            { auto or manual }
  109.  mdDate: TimeStamp;                            { last change in document }
  110.  sectionID: LONGINT;                        { app. specific, unique per document }
  111.  refCon: LONGINT;                            { application specific }
  112.  alias: AliasHandle;                        { handle to Alias Record }
  113.  subPart: LONGINT;                            { which part of container file }
  114.  nextSection: SectionHandle;                { for linked list of app's Sections }
  115.  controlBlock: Handle;                        { used internally }
  116.  refNum: EditionRefNum;                        { used internally }
  117.  END;
  118.  
  119. EditionContainerSpecPtr = ^EditionContainerSpec;
  120. EditionContainerSpec = RECORD
  121.  theFile: FSSpec;
  122.  theFileScript: ScriptCode;
  123.  thePart: LONGINT;
  124.  thePartName: Str31;
  125.  thePartScript: ScriptCode;
  126.  END;
  127.  
  128. EditionInfoRecord = RECORD
  129.  crDate: TimeStamp;                            { date EditionContainer was created }
  130.  mdDate: TimeStamp;                            { date of last change }
  131.  fdCreator: OSType;                            { file creator }
  132.  fdType: OSType;                            { file type }
  133.  container: EditionContainerSpec;            { the Edition }
  134.  END;
  135.  
  136. NewPublisherReply = RECORD
  137.  canceled: BOOLEAN;                            { O }
  138.  replacing : BOOLEAN;
  139.  usePart: BOOLEAN;                            { I }
  140.  preview: Handle;                            { I }
  141.  previewFormat: FormatType;                    { I }
  142.  container: EditionContainerSpec;            { I/O }
  143.  END;
  144.  
  145. NewSubscriberReply = RECORD
  146.  canceled: BOOLEAN;                            { O }
  147.  formatsMask: SignedByte;
  148.  container: EditionContainerSpec;            {I/O}
  149.  END;
  150.  
  151. SectionOptionsReply = RECORD
  152.  canceled: BOOLEAN;                            { O }
  153.  changed: BOOLEAN;                            { O }
  154.  sectionH: SectionHandle;                    { I }
  155.  action: ResType;                            { O }
  156.  END;
  157.  
  158.  
  159. ExpModalFilterProcPtr = ProcPtr;            { FUNCTION Filter(theDialog: DialogPtr; VAR theEvent: EventRecord; itemOffset: INTEGER; VAR itemHit: INTEGER; yourDataPtr: Ptr): BOOLEAN; }
  160. ExpDlgHookProcPtr = ProcPtr;                { FUNCTION Hook(itemOffset, item: INTEGER; theDialog: DialogPtr; yourDataPtr: Ptr): INTEGER; }
  161.  
  162. FormatIOVerb = (ioHasFormat,ioReadFormat,ioNewFormat,ioWriteFormat);
  163.  
  164.  
  165. FormatIOParamBlock = RECORD
  166.  ioRefNum: LONGINT;
  167.  format: FormatType;
  168.  formatIndex: LONGINT;
  169.  offset: LONGINT;
  170.  buffPtr: Ptr;
  171.  buffLen: LONGINT;
  172.  END;
  173.  
  174.  
  175. FormatIOProcPtr = ProcPtr;                    { FUNCTION IO(selector: FormatIOVerb; VAR PB: FormatIOParamBlock): OSErr; }
  176.  
  177. EditionOpenerVerb = (eoOpen,eoClose,eoOpenNew,eoCloseNew,eoCanSubscribe);
  178.  
  179.  
  180. EditionOpenerParamBlock = RECORD
  181.  info: EditionInfoRecord;
  182.  sectionH: SectionHandle;
  183.  document: FSSpecPtr;
  184.  fdCreator: OSType;
  185.  ioRefNum: LONGINT;
  186.  ioProc: FormatIOProcPtr;
  187.  success: BOOLEAN;
  188.  formatsMask: SignedByte;
  189.  END;
  190.  
  191.  
  192. EditionOpenerProcPtr = ProcPtr;                { FUNCTION Opener(selector: EditionOpenerVerb; VAR PB: EditionOpenerParamBlock): OSErr; }
  193.  
  194. CONST
  195.  
  196.  Section events now arrive in the message buffer using the AppleEvent format.
  197.  The direct object parameter is an aeTemporaryIDParamType ('tid '). The temporary
  198.  ID's type is rSectionType ('sect') and the 32-bit value is a SectionHandle.
  199.  The following is a sample buffer
  200.  
  201.  name   offset contents
  202.  ----   ------ --------
  203.  
  204.  header   0  'aevt'
  205.  majorVersion 4  0x01
  206.  minorVersion 6  0x01
  207.  endOfMetaData 8  ';;;;' 
  208.  directObjKey 12  '----' 
  209.  paramType  16  'tid ' 
  210.  paramLength  20  0x0008 
  211.  tempIDType  24  'sect' 
  212.  tempID    28  the SectionHandle <-- this is want you want}
  213.  
  214. sectionEventMsgClass = 'sect';
  215. sectionReadMsgID = 'read';
  216. sectionWriteMsgID = 'writ';
  217. sectionScrollMsgID = 'scrl';
  218. sectionCancelMsgID = 'cncl';
  219.  
  220. FUNCTION InitEditionPack: OSErr;
  221.  INLINE $3F3C,$0011,$303C,$0100,$A82D;
  222. FUNCTION NewSection(container: EditionContainerSpec;
  223.                     sectionDocument: FSSpecPtr;
  224.                     kind: SectionType;
  225.                     sectionID: LONGINT;
  226.                     initalMode: UpdateMode;
  227.                     VAR sectionH: SectionHandle): OSErr;
  228.  INLINE $303C,$0A02,$A82D;
  229. FUNCTION RegisterSection(sectionDocument: FSSpec;
  230.                          sectionH: SectionHandle;
  231.                          VAR aliasWasUpdated: BOOLEAN): OSErr;
  232.  INLINE $303C,$0604,$A82D;
  233. FUNCTION UnRegisterSection(sectionH: SectionHandle): OSErr;
  234.  INLINE $303C,$0206,$A82D;
  235. FUNCTION IsRegisteredSection(sectionH: SectionHandle): OSErr;
  236.  INLINE $303C,$0208,$A82D;
  237. FUNCTION AssociateSection(sectionH: SectionHandle;
  238.                           newSectionDocument: FSSpecPtr): OSErr;
  239.  INLINE $303C,$040C,$A82D;
  240. FUNCTION CreateEditionContainerFile(editionFile: FSSpec;
  241.                                     fdCreator: OSType;
  242.                                     editionFileNameScript: ScriptCode): OSErr;
  243.  INLINE $303C,$050E,$A82D;
  244. FUNCTION DeleteEditionContainerFile(editionFile: FSSpec): OSErr;
  245.  INLINE $303C,$0210,$A82D;
  246. FUNCTION OpenEdition(subscriberSectionH: SectionHandle;
  247.                      VAR refNum: EditionRefNum): OSErr;
  248.  INLINE $303C,$0412,$A82D;
  249. FUNCTION OpenNewEdition(publisherSectionH: SectionHandle;
  250.                         fdCreator: OSType;
  251.                         publisherSectionDocument: FSSpecPtr;
  252.                         VAR refNum: EditionRefNum): OSErr;
  253.  INLINE $303C,$0814,$A82D;
  254. FUNCTION CloseEdition(whichEdition: EditionRefNum;
  255.                       successful: BOOLEAN): OSErr;
  256.  INLINE $303C,$0316,$A82D;
  257. FUNCTION EditionHasFormat(whichEdition: EditionRefNum;
  258.                           whichFormat: FormatType;
  259.                           VAR formatSize: Size): OSErr;
  260.  INLINE $303C,$0618,$A82D;
  261. FUNCTION ReadEdition(whichEdition: EditionRefNum;
  262.                      whichFormat: FormatType;
  263.                      buffPtr: UNIV Ptr;
  264.                      VAR buffLen: Size): OSErr;
  265.  INLINE $303C,$081A,$A82D;
  266. FUNCTION WriteEdition(whichEdition: EditionRefNum;
  267.                       whichFormat: FormatType;
  268.                       buffPtr: UNIV Ptr;
  269.                       buffLen: Size): OSErr;
  270.  INLINE $303C,$081C,$A82D;
  271. FUNCTION GetEditionFormatMark(whichEdition: EditionRefNum;
  272.                               whichFormat: FormatType;
  273.                               VAR currentMark: LONGINT): OSErr;
  274.  INLINE $303C,$061E,$A82D;
  275. FUNCTION SetEditionFormatMark(whichEdition: EditionRefNum;
  276.                               whichFormat: FormatType;
  277.                               setMarkTo: LONGINT): OSErr;
  278.  INLINE $303C,$0620,$A82D;
  279. FUNCTION GetEditionInfo(sectionH: SectionHandle;
  280.                         VAR editionInfo: EditionInfoRecord): OSErr;
  281.  INLINE $303C,$0422,$A82D;
  282. FUNCTION GoToPublisherSection(container: EditionContainerSpec): OSErr;
  283.  INLINE $303C,$0224,$A82D;
  284. FUNCTION GetLastEditionContainerUsed(VAR container: EditionContainerSpec): OSErr;
  285.  INLINE $303C,$0226,$A82D;
  286. FUNCTION GetStandardFormats(container: EditionContainerSpec;
  287.                             VAR previewFormat: FormatType;
  288.                             preview: Handle;
  289.                             publisherAlias: Handle;
  290.                             formats: Handle): OSErr;
  291.  INLINE $303C,$0A28,$A82D;
  292. FUNCTION GetEditionOpenerProc(VAR opener: EditionOpenerProcPtr): OSErr;
  293.  INLINE $303C,$022A,$A82D;
  294. FUNCTION SetEditionOpenerProc(opener: EditionOpenerProcPtr): OSErr;
  295.  INLINE $303C,$022C,$A82D;
  296. FUNCTION CallEditionOpenerProc(selector: EditionOpenerVerb;
  297.                                VAR PB: EditionOpenerParamBlock;
  298.                                routine: EditionOpenerProcPtr): OSErr;
  299.  INLINE $303C,$052E,$A82D;
  300. FUNCTION CallFormatIOProc(selector: FormatIOVerb;
  301.                           VAR PB: FormatIOParamBlock;
  302.                           routine: FormatIOProcPtr): OSErr;
  303.  INLINE $303C,$0530,$A82D;
  304. FUNCTION NewSubscriberDialog(VAR reply: NewSubscriberReply): OSErr;
  305.  INLINE $303C,$0232,$A82D;
  306. FUNCTION NewSubscriberExpDialog(VAR reply: NewSubscriberReply;
  307.                                 where: Point;
  308.                                 expansionDITLresID: INTEGER;
  309.                                 dlgHook: ExpDlgHookProcPtr;
  310.                                 filterProc: ExpModalFilterProcPtr;
  311.                                 yourDataPtr: UNIV Ptr): OSErr;
  312.  INLINE $303C,$0B34,$A82D;
  313. FUNCTION NewPublisherDialog(VAR reply: NewPublisherReply): OSErr;
  314.  INLINE $303C,$0236,$A82D;
  315. FUNCTION NewPublisherExpDialog(VAR reply: NewPublisherReply;
  316.                                where: Point;
  317.                                expansionDITLresID: INTEGER;
  318.                                dlgHook: ExpDlgHookProcPtr;
  319.                                filterProc: ExpModalFilterProcPtr;
  320.                                yourDataPtr: UNIV Ptr): OSErr;
  321.  INLINE $303C,$0B38,$A82D;
  322. FUNCTION SectionOptionsDialog(VAR reply: SectionOptionsReply): OSErr;
  323.  INLINE $303C,$023A,$A82D;
  324. FUNCTION SectionOptionsExpDialog(VAR reply: SectionOptionsReply;
  325.                                  where: Point;
  326.                                  expansionDITLresID: INTEGER;
  327.                                  dlgHook: ExpDlgHookProcPtr;
  328.                                  filterProc: ExpModalFilterProcPtr;
  329.                                  yourDataPtr: UNIV Ptr): OSErr;
  330.  INLINE $303C,$0B3C,$A82D;
  331.  
  332.  
  333. {$ENDC} { UsingEditions }
  334.  
  335. {$IFC NOT UsingIncludes}
  336.  END.
  337. {$ENDC}
  338.  
  339.